import request from '@/router/axios';

/**
 * 获取列表
 * @param current
 * @param size
 * @param params
 * @returns {*}
 */
export const getList = (current, size, params) =>{
  return request({
    url: '/api/beetles-business/app/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
/**
 * 新增/修改
 * @param data
 * @returns {*}
 */
export const addApp = (data) =>{
  return request({
    url:'/api/beetles-business/app/submit',
    method:'post',
    timeout: 3600 * 1000,
    data:data
  })
}
/**
 * 删除
 * @param data
 * @returns {*}
 */
export const removeApp = (data) =>{
  return request({
    url:'/api/beetles-business/app/remove',
    method:'delete',
    params:{
      ids:data
    }
  })
}

/**
 * 三方配置 返回token
 * @param params
 * @returns {*}
 */
export const backToken = (params)=>{
  return request({
    url:'/api/beetles-business/app/mmp/get-token',
    method:'get',
    params:{
      platform:params
    }
  })
}
/**
 * 三方配置 新增/修改 token
 */
export const submitToken = (data) =>{
  return request({
    url:'/api/beetles-business/app/mmp/submit-token',
    method:'post',
    data:data
  })
}

/**
 * 跟踪配置 detail
 */
export const detail = (id) =>{
  return request({
    url:'/api/beetles-business/app/detail',
    method:'get',
    params:{
      id:id
    }
  })
}

/**
 * 跟踪配置 获取基础数据  beetles事件 以及 显示名
 */
export const getBaseEvent = () =>{
  return request({
    url:'/api/beetles-business/app/get-base-event',
    method:'get',
  })
}

/**
 * 跟踪配置 获取sdk数据 sdk事件名称 以及 adjust 事件token
 */
export const getEvent = (id,platform,token) =>{
  return request ({
    url:'/api/beetles-business/app/get-event',
    method:'post',
    data:{
      id,
      platform,
      token
    }
  })
}

/**
 * 跟踪配置 获取历史保存事件
 */
export const getSavedEvent = (params) =>{
  return request({
    url:'/api/beetles-business/app/get-saved-event',
    method:'get',
    params:{
      appId:params
    }
  })
}

/**
 * 跟踪配置 提交
 */
export const saveEvent = (data) =>{
  return request({
    url:'/api/beetles-business/app/save-event',
    method:'post',
    data:data,
  })
}

/**
 * 订单管理 获取 安卓/ios url列表
 */
export const getAppUrlSelect = (customerId,os) =>{
  return request ({
    url:'/api/beetles-business/app/get-app-select-by-customer',
    method:'get',
    params:{
      customerId,
      os
    }
  })
}

/**
 * 获取时区
 */
export const getTimezome = () =>{
  return request({
    url:'/api/beetles-business/app/get-timezone',
    method:'get'
  })
}

/**
 * 获取双平台时区
 */
export const getAllTimezome = () =>{
  return request({
    url:'/api/beetles-business/timezone/get',
    method:'get'
  })
}

/**
 * 获取所有产品名称
 */
export const getProductName = () =>{
  return request({
    url: '/api/beetles-business/app/get_product_name',
    method: 'get',
  })
}

// 媒体事件字典获取接口
export const getDictionaryTree = params =>{
  return request({
    url: '/api/blade-system/dict/dictionary-tree',
    method: 'get',
    params
  })
}
// 媒体事件保存
export const saveEventPlatform = data =>{
  return request({
    url: '/api/beetles-business/app/save-event-platform',
    method: 'POST',
    data
  })
}
// 媒体事件查询
export const querySavedEventPlatform = params =>{
  return request({
    url: '/api/beetles-business/app/get-saved-event-platform',
    method: 'GET',
    params
  })
}

// 获取谷歌媒体事件
export const queryGoogleMediaEvent = params =>{
  return request({
    url: '/api/beetles-business/app/get_google_event_name',
    method: 'GET',
    params
  })
}

//商品url校验
export const verifyProductUrl = data =>{
  return request ({
    url:'/api/beetles-business/app/verify',
    method:'post',
    data
  })
}

